$("#cart_index").on('pagebeforecreate',function(){
	$("#cart_index").on( "click","#orderShowConfirmBtn", function(event, ui) {
		if($("#cartView li").length==0){
			$("#err_info").html("购物车还没有商品！");
			$("#err_info").show();
			return false;
		}
		
		if($("#sendAddress").val()==""){
			$("#err_info").html("配送地址尚未设置！");
			$("#err_info").show();
			return false;
		}
		var optionSelected = $("#sendAddress").find("option:selected");
		$("#cust_name").val(optionSelected.attr('cust_name'));
		$("#cust_mobile").val(optionSelected.attr('cust_mobile'));
		$("#cust_address").val(optionSelected.attr('cust_address'));
		$('#form_edit').submit();
	});
	
	$("#cart_index").on( "click","#cartEmptyBtn", function(event, ui) {
		if(confirm('确定清空购物车')){
			document.location.href="/Cart/doEmpty.html";
		}
	});
});


function chooseAddress(){
	if($("#sendAddress").val()==""){
		document.location.href="/CustAddress/index.html";
	}
}
